﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace RemoteBank
{
    class Check
    {
        public static bool checkNull(string a)
        {
            if (a.Length==0)
            {
                return false;
            } return true;
        }
        public static bool checkNumber(string number)
        {
            Double num;
            if (number != number)
            {
                if (Double.TryParse(number, out num))
                {
                    return true;
                }
            }
            return false;
        }
        public static bool checkMail(string mails)
        {
            String pattern = @"^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$";
            Regex re = new Regex(pattern);
            if (re.IsMatch(mails))
            {
                return (true);
            }
            else
            {
                return (false);
            }
        }
        public static bool checkDate(string str)
        {
            try
            {
                DateTime d = Convert.ToDateTime(str);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
    }
}
